import { acceptHMRUpdate, defineStore } from 'pinia'
import { userInfo } from "/@/api/index"
import {  ref } from 'vue'
// export const useCounterStore = defineStore('counter', {
//     state: () => ({ 
//         storeFormfullData: {},
//         storeNum: ''
//     }),
//     actions: { 
//         getFormfullData(v) {
//             this.storeFormfullData = {...this.storeFormfullData, ...v}
//         },
//         getNum(v) {
//             this.storeNum = v 
//         }
//      }
// })
export const userInfoStrore = defineStore('userInfo', () => {
    const transactionId = ref("")
    const userInfoObj = ref({})
    const proWritingUsetInfo = ref({})
    const setTransactionId = (id:any) => {
        transactionId.value = id
    }
    const postUserInfo = (obj:any) => {
        userInfoObj.value = obj
    }
    const postProWritingUsetInfo = (obj:any) => {
        proWritingUsetInfo.value = obj
    }
    const setUserInfo = async(params:any) => {
        userInfoObj.value = params
    }
    const storeFormfullData = ref({})
    const getFormfullData = async(params:any) => {
        console.log(params)
        storeFormfullData.value = params
        // storeFormfullData.value = {...storeFormfullData.value, ...params}

    }
    const storeNum = ref('')
    const getNum = async(params:any) => {
        storeNum.value = params
    }
    return { storeNum,storeFormfullData,transactionId, userInfoObj,proWritingUsetInfo,getNum,getFormfullData,setTransactionId, postUserInfo,postProWritingUsetInfo, setUserInfo }
},{
    persist: true
})

if (import.meta.hot) {
    import.meta.hot.accept(acceptHMRUpdate(userInfoStrore, import.meta.hot))
}  